#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<dirent.h>
#include<fcntl.h>
#include<unistd.h> 
#include<pthread.h>

int
main(int argc, char* args[])
{
	DIR* dp;

	dp = opendir(args[1]);
	if(!dp){
		perror("open erroe");
		exit(1);
	}

	struct dirent* sde; 
	sde =  readdir(dp);
	errno = 0;
	while((sde = readdir(dp))){
		printf("file name is %s\n",sde->d_name);
	}
	if(errno)	perror("readdir failed");

	closedir(dp);

	return 0;

}
